package com.ztman.service.work.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.alibaba.druid.sql.dialect.mysql.ast.expr.MySqlJSONTableExpr;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ztman.basic.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ztman.service.common.properties.MySqlJSONArrayHandler;
import com.ztman.service.common.properties.MySqlJsonHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import static com.ztman.basic.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 *
 * </p>
 *
 * @author wsd
 * @since 2021-08-23
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "p_work_order_info", autoResultMap = true)
@ApiModel(value = "WorkOrderInfo", description = "")
@AllArgsConstructor
public class WorkOrderInfo extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @Length(max = 128, message = "长度不能超过128")
    @TableField(value = "title", condition = LIKE)
    @Excel(name = "")
    private String title;

    @ApiModelProperty(value = "")
    @TableField("priority")
    @Excel(name = "")
    private Long priority;

    @ApiModelProperty(value = "")
    @TableField("process")
    @Excel(name = "")
    private Long process;

    @ApiModelProperty(value = "")
    @TableField("classify")
    @Excel(name = "")
    private Long classify;

    @ApiModelProperty(value = "")
    @TableField("is_end")
    @Excel(name = "")
    private Integer isEnd;

    @ApiModelProperty(value = "")
    @TableField("is_denied")
    @Excel(name = "")
    private Integer isDenied;

    @ApiModelProperty(value = "")
    @TableField(value = "state", typeHandler = MySqlJSONArrayHandler.class)
    @Excel(name = "")
    private JSONArray state;

    @ApiModelProperty(value = "相关人士")
    @TableField(value = "related_person", typeHandler = MySqlJSONArrayHandler.class)
    @Excel(name = "")
    private JSONArray relatedPerson;

    @ApiModelProperty(value = "")
    @TableField("urge_count")
    @Excel(name = "")
    private Integer urgeCount;

    @ApiModelProperty(value = "")
    @TableField("urge_last_time")
    @Excel(name = "")
    private Long urgeLastTime;
    /**
     * 删除状态
     */
    @ApiModelProperty(value = "删除状态")
    @TableField("del_flag")
    @Excel(name = "删除状态", replace = {"是_true", "否_false", "_null"})
    private Boolean delFlag;

    @TableField(exist = false)
    private String CurrentState;

    @Builder
    public WorkOrderInfo(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy,
                         String title, Long priority, Long process, Long classify, Integer isEnd,
                         Integer isDenied, JSONArray state, JSONArray relatedPerson, Integer urgeCount, Long urgeLastTime) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.title = title;
        this.priority = priority;
        this.process = process;
        this.classify = classify;
        this.isEnd = isEnd;
        this.isDenied = isDenied;
        this.state = state;
        this.relatedPerson = relatedPerson;
        this.urgeCount = urgeCount;
        this.urgeLastTime = urgeLastTime;
    }

}
